<?php

namespace common\jobs;

use Yii;
use yii\helpers\Console;
use yii\console\Exception;

/**
 * 测试队列
 */
class TestJob extends BaseRetryableJob {

    public $data = [];
    public $time = '';

    /**
     * @param \yii\queue\Queue $queue which pushed and is handling the job
     */
    public function execute($queue) {
        Console::output('Test Job running...');
        Yii::error([
            $this->data,
        ], __METHOD__);
        Console::output('This time is:' . $this->time);
        Console::output('Test Job Ok.');

        throw new Exception('Test Job exception');
    }

}
